'''列表推导式
[表达式 for 变量 in 可迭代对象]
'''
#将表达式和可迭代对象结合起来生成一个列表
l = [x for x in range(1,10)]
print(l)
print('------------------------------')

#1，2，4，5，7，8
l = [x for x in range(1,10) if x%3!=0]
print(l)
print('------------------------------')

# x^n
l = [x*x for x in range(1,6)]
print(l)

print('------------------------------')
# x*m
l= [x*m for x in range(1,4) for m in range(1,4)]
print(l)

print('------------------------------')
l = [x*m for x in range(1,4) for m in range(1,4,2)]
print(l)

print('------------------------------')
l = [x*m for x in range(1,4,2) for m in range(1,4,2)]
print(l)

print('------------------------------')
num = []
for i in range(2,1001):
    l = [i%x for x in range(2,i)]
    if all(l):
        num.append(i)
    # if l.count(0)==0:
    #     num.append(i)
print(num)



